cmake_minimum_required(VERSION 3.14)

project(WeChat VERSION 1.0 LANGUAGES CXX)

# 设置 C++ 标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 自动调用 moc、uic、rcc 等工具
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# 查找 Qt6 库
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

# # 这里无效 todo
# include_directories(${Qt6Core_INCLUDE_DIRS})
# include_directories(${Qt6Gui_INCLUDE_DIRS})
# include_directories(${Qt6Widgets_INCLUDE_DIRS})

# 收集 model 文件夹中的所有 .cpp 和 .h 文件
file(GLOB MODEL_SOURCES "model/*.cpp" "model/*.h")

# 将 model 文件夹中的文件分组
source_group("model" FILES ${MODEL_SOURCES})

# 添加可执行文件
add_executable(WeChat
    main.cpp
    mainwidget.h
    mainwidget.cpp
    sessionfriendarea.h
    sessionfriendarea.cpp
    messageshowarea.h
    messageshowarea.cpp
    messageeditarea.h
    messageeditarea.cpp
    debug.h
    resource.qrc
    ${MODEL_SOURCES}  # 添加 model 文件夹中的文件
)

# 链接 Qt6 库
target_link_libraries(WeChat PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets)

# 设置可执行文件的输出目录
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)

